<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans,en,default">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/java.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/java_color2.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/java_color.png?v=5.1.4">


  <link rel="mask-icon" href="/images/java.png?v=5.1.4" color="#222">





  <meta name="keywords" content="hexo系列,blog,">










<meta name="description" content="本文意在构建免费自用博客，使用GitHub管理博客内容，使用GitHub Pages功能发布博客，访问的地址形如： https://xxxx.github.io 软件安装hexo的安装依赖于node.js和npm，环境搭建好后，使用如下安装命令安装hexo： 1npm install -g hexo-cli 使用如下命令安装hexo自动发布到GitHub的插件： 1npm install hexo">
<meta name="keywords" content="hexo系列,blog">
<meta property="og:type" content="article">
<meta property="og:title" content="hexo系列(二)自建博客之hexo+github+Typora">
<meta property="og:url" content="http://blog.bsquartz.com/hexo02-github-Typora.html">
<meta property="og:site_name" content="xjcooo&#39;s blog">
<meta property="og:description" content="本文意在构建免费自用博客，使用GitHub管理博客内容，使用GitHub Pages功能发布博客，访问的地址形如： https://xxxx.github.io 软件安装hexo的安装依赖于node.js和npm，环境搭建好后，使用如下安装命令安装hexo： 1npm install -g hexo-cli 使用如下命令安装hexo自动发布到GitHub的插件： 1npm install hexo">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://blog.bsquartz.com/images/image-20190322232130511.png">
<meta property="og:image" content="http://blog.bsquartz.com/images/image-20190322233527293.png">
<meta property="og:image" content="http://blog.bsquartz.com/images/image-20190322234438231.png">
<meta property="og:updated_time" content="2021-11-20T14:56:59.466Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="hexo系列(二)自建博客之hexo+github+Typora">
<meta name="twitter:description" content="本文意在构建免费自用博客，使用GitHub管理博客内容，使用GitHub Pages功能发布博客，访问的地址形如： https://xxxx.github.io 软件安装hexo的安装依赖于node.js和npm，环境搭建好后，使用如下安装命令安装hexo： 1npm install -g hexo-cli 使用如下命令安装hexo自动发布到GitHub的插件： 1npm install hexo">
<meta name="twitter:image" content="http://blog.bsquartz.com/images/image-20190322232130511.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://blog.bsquartz.com/hexo02-github-Typora.html">





  <title>hexo系列(二)自建博客之hexo+github+Typora | xjcooo's blog</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">xjcooo's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">站上巨人肩上,一览天尽头的风景</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://blog.bsquartz.com/hexo02-github-Typora.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="scott">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/images/head.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="xjcooo's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">hexo系列(二)自建博客之hexo+github+Typora</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-03-22T22:54:23+08:00">
                2019-03-22
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/hexo笔记/" itemprop="url" rel="index">
                    <span itemprop="name">hexo笔记</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>本文意在构建免费自用博客，使用GitHub管理博客内容，使用GitHub Pages功能发布博客，访问的地址形如：</p>
<p><a href="https://xxxx.github.io" target="_blank" rel="noopener">https://xxxx.github.io</a></p>
<h1 id="软件安装"><a href="#软件安装" class="headerlink" title="软件安装"></a>软件安装</h1><h2 id="hexo的安装"><a href="#hexo的安装" class="headerlink" title="hexo的安装"></a>hexo的安装</h2><p>依赖于node.js和npm，环境搭建好后，使用如下安装命令安装hexo：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure>
<p>使用如下命令安装hexo自动发布到GitHub的插件：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>
<h2 id="GitHub依赖安装"><a href="#GitHub依赖安装" class="headerlink" title="GitHub依赖安装"></a>GitHub依赖安装</h2><p>不同平台安装方式请自行搜索不做赘述</p>
<h2 id="Typora的安装"><a href="#Typora的安装" class="headerlink" title="Typora的安装"></a>Typora的安装</h2><p><a href="https://www.typora.io/" target="_blank" rel="noopener">下载地址</a></p>
<p>请根据自己系统下载，开箱即用</p>
<h1 id="使用说明"><a href="#使用说明" class="headerlink" title="使用说明"></a>使用说明</h1><h2 id="hexo"><a href="#hexo" class="headerlink" title="hexo"></a>hexo</h2><p>简易使用见本博客的文章《hello-world》</p>
<h2 id="GitHub"><a href="#GitHub" class="headerlink" title="GitHub"></a>GitHub</h2><ol>
<li>首先登陆GitHub，</li>
<li>新建一个仓库，项目名称形如xxx.github.io，其中xxx以为任意字母组合</li>
</ol>
<p><img src="/images/image-20190322232130511.png" alt="image-20190322232130511"></p>
<p>​    GitHub Pages默认可以使用<code>Jekyll</code>的方式来管理博客，由于本文使用的是hexo，所以发布以静态页面的方式来发布博客，配置页面如下：</p>
<p><img src="/images/image-20190322233527293.png" alt="image-20190322233527293"></p>
<ol>
<li>hexo自动上传博客使用的是hexo-deployer-git插件，需要修改_config.yml配置：</li>
</ol>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">	<span class="attr">type:</span> <span class="string">git</span></span><br><span class="line">	<span class="attr">repo:</span> <span class="string">&lt;repository</span> <span class="string">url&gt;</span></span><br><span class="line">	<span class="attr">branch:</span> <span class="string">[branch]</span></span><br><span class="line">	<span class="attr">message:</span> <span class="string">[message]</span></span><br></pre></td></tr></table></figure>
<div class="table-container">
<table>
<thead>
<tr>
<th>参数</th>
<th style="text-align:left">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>repo</td>
<td style="text-align:left">Git仓库地址</td>
</tr>
<tr>
<td>branch</td>
<td style="text-align:left">分支名称，请使用master分支，以保证Git会自动检索到博客，来发布博客</td>
</tr>
<tr>
<td>message</td>
<td style="text-align:left">自定义提交信息（默认为<code>Site update:YYYY-MM-DD HH:mm:ss</code>)</td>
</tr>
</tbody>
</table>
</div>
<p><img src="/images/image-20190322234438231.png" alt="image-20190322234438231"></p>
<ol>
<li>使用<code>hexo g &amp;&amp; hexo deploy</code>将内容推送到GitHub上，此时即可使用<a href="https://xxx.github.io进行访问了，也就是上面Git仓库配置图中`Your" target="_blank" rel="noopener">https://xxx.github.io进行访问了，也就是上面Git仓库配置图中`Your</a> site is ready to be published at`后面的地址</li>
</ol>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/hexo系列/" rel="tag"># hexo系列</a>
          
            <a href="/tags/blog/" rel="tag"># blog</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/hexo01Start.html" rel="next" title="hexo系列(一)新建博客站点">
                <i class="fa fa-chevron-left"></i> hexo系列(一)新建博客站点
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/hexo03editStyle.html" rel="prev" title="hexo系列(三)自建博客之样式修改">
                hexo系列(三)自建博客之样式修改 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/head.png" alt="scott">
            
              <p class="site-author-name" itemprop="name">scott</p>
              <p class="site-description motion-element" itemprop="description">一个程序员中的小学生</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">10</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">4</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#软件安装"><span class="nav-number">1.</span> <span class="nav-text">软件安装</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#hexo的安装"><span class="nav-number">1.1.</span> <span class="nav-text">hexo的安装</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#GitHub依赖安装"><span class="nav-number">1.2.</span> <span class="nav-text">GitHub依赖安装</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Typora的安装"><span class="nav-number">1.3.</span> <span class="nav-text">Typora的安装</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#使用说明"><span class="nav-number">2.</span> <span class="nav-text">使用说明</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#hexo"><span class="nav-number">2.1.</span> <span class="nav-text">hexo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#GitHub"><span class="nav-number">2.2.</span> <span class="nav-text">GitHub</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">scott</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io" rel="external nofollow">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next" rel="external nofollow">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

</body>
</html>
